#region Microsoft Public License
/*
 * (c) Copyright Chenjun Wu. http://utablesdk.codeplex.com
 * 
 * This source is subject to the Microsoft Public License (Ms-PL).
 * Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
 * All other rights reserved.
 */
#endregion

﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using UTable.Input;
using UTable.Input.MultiTouch;
using UTable.Objects;
using UTable.Objects.Controls;

namespace UTable.Objects.Controls
{
	/// <summary>
	/// Interaction logic for UConfirmDialog.xaml
	/// </summary>
	public partial class UConfirmDialog : UDialog
	{
		public UConfirmDialog()
		{
			InitializeComponent();
			this.DataContext = this;
		}

		public String Message
		{
			get { return (String)GetValue(MessageProperty); }
			set { SetValue(MessageProperty, value); }
		}

		public static readonly DependencyProperty MessageProperty =
			DependencyProperty.Register("Message", typeof(String), typeof(UConfirmDialog), new UIPropertyMetadata(string.Empty));


		private void OkButton_Pressed(object sender, ButtonEventArgs args)
		{
			Close(new UConfirmDialogResult(UConfirmDialogResultType.Ok));
		}

		private void CancelButton_Pressed(object sender, ButtonEventArgs args)
		{
			Close(new UConfirmDialogResult(UConfirmDialogResultType.Cancel));
		}
	}

	public enum UConfirmDialogResultType
	{
		Ok,
		Cancel,
	}

	public class UConfirmDialogResult: UDialogResult
	{
		public UConfirmDialogResult(UConfirmDialogResultType result)
		{
			this.Result = result;
		}

		public UConfirmDialogResultType Result { get; protected set; }
	}
}
